#-*- coding: utf-8 -*-

from cocos.actions import *

class ScaleXY(IntervalAction):
	"""Scales a `CocosNode` object by modify scalex, scaley
	"""

	def init(self,scalex,scaley,duration):
		self.end_scalex=scalex
		self.end_scaley=scaley
		self.duration=duration

	def start(self):
		self.start_scalex=self.target.scalex
		self.start_scaley=self.target.scaley
		self.deltax=self.end_scalex-self.start_scalex
		self.deltay=self.end_scaley-self.start_scaley

	def update(self,t):
		self.target.scalex=self.start_scalex+self.deltax*t
		self.target.scaley=self.start_scaley+self.deltay*t
